package crudfx.data;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class Fields {
  //var values:String[];
  //public var names:String[];
  public var fields:NamedValue[];
  public function get(name:String):String{
      var n:Integer=find(name);
      return fields[n].value;
      }
  public function set(name:String,value:String):Void{
      var n:Integer=find(name);
      fields[n].value=value;
      }
  function find(name:String):Integer{
      var n:Integer=0;
      var sz:Integer=sizeof fields;
      while(n<sz){
          if(fields[n].name.equals(name))return n;
          n++;
          }
      /*insert name into names;
      insert "" into values;*/
      insert NamedValue{
          name:name
          value:""
          } into fields;
      return (sizeof fields)-1;
      }
  }
